<template>
  <div class="animate-child">
    <button @click="isShow = !isShow">显示/隐藏</button>
    <!--
        appear是否有进场动画
        name动画名 默认.v
        transition-group 包裹多个动画\
        如果不想如此可以用一个DIV包裹
    -->
    <transition-group name="mine" appear>
      <h1 v-show="isShow" key="helllo">hello ~~~</h1>
      <h1 v-show="isShow" key="fine">hi ~~~~~~~~~~~~~~~~~~~~~~</h1>
    </transition-group>
  </div>
</template>

<script>
export default {
  data() {
    return {
      isShow: true
    }
  }
}
</script>

<style scoped>
@keyframes moveIn {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0px);
  }
}
/* 默认.v- */
.mine-enter-active {
  animation: moveIn 1s;
}
.mine-leave-active {
  animation: moveIn 1s reverse;
}
</style>
